package com.wuxianggujun.ide.ui.preferences;

import static java.util.Objects.requireNonNull;

import android.content.Intent;
import android.os.Bundle;

import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;

import com.wuxianggujun.ide.ui.R;
import com.wuxianggujun.ide.ui.preferences.licenses.LicensesUI;

/**
 * @project: JvIDE
 * @author: WEG
 * @description:
 **/
public class HeadersPreferences extends PreferenceFragmentCompat {
    @Override
    public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
        addPreferencesFromResource(R.xml.headers_preferences);

        Preference plugin =findPreference("pref_plugin");
        requireNonNull(plugin).setVisible(false);

        Preference terminal =findPreference("pref_terminal");
        requireNonNull(terminal).setVisible(false);

        Preference licenses=findPreference("pref_licenses");
        requireNonNull(licenses).setOnPreferenceClickListener(preference -> {
            startActivity(new Intent(getActivity(), LicensesUI.class));
            return true;
        });
    }
}
